package com.cinematicketscaning.app.controller

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.cinematicketscaning.app.R
import com.cinematicketscaning.app.controller.base.BaseActivity
import com.cinematicketscaning.app.utils.Utils
import kotlinx.android.synthetic.main.activity_movie.*
import java.util.*

class MovieActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_movie)
        initView()
    }

    private fun initView() {
        clayout_ticket_detail.setOnClickListener {
            finish()
        }
    }

    override fun isUseTimeReceiver(): Boolean {
        return true
    }

    override fun updateTime() {
        val calendar = Utils.initCalendar()
        val hours = calendar.get(Calendar.HOUR_OF_DAY).toString()
        val minutes = calendar.get(Calendar.MINUTE).toString()
        if (hours.length > 1) {
            tv_time1.text = hours[0].toString()
            tv_time2.text = hours[1].toString()
        } else {
            tv_time1.text = "0"
            tv_time2.text = hours
        }
        if (minutes.length > 1) {
            tv_time3.text = minutes[0].toString()
            tv_time4.text = minutes[1].toString()
        } else {
            tv_time3.text = "0"
            tv_time4.text = minutes
        }
    }
}
